package cn.by.wms.enums;

import java.util.Arrays;
import java.util.Optional;

public enum VendorStatus {
    EFFECTIVE(1, "有效"),
    INVAIN(2, "失效"),
    DELETE(120, "删除");

    private int code;
    private String massage;

    private VendorStatus() {
    }

    private VendorStatus(int code, String massage) {
        this.code = code;
        this.massage = massage;
    }

    public int getCode() {
        return this.code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMassage() {
        return this.massage;
    }

    public void setMassage(String massage) {
        this.massage = massage;
    }

    public static VendorStatus getProductStatusByCode(int code) {
        VendorStatus[] values = VendorStatus.values();
        Optional<VendorStatus> first = Arrays.stream(values).filter(item -> item.getCode() == code).findFirst();
        return first.orElse(null);

    }
}
